package com.servlet3.demo2.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
public class IndexController {

    @RequestMapping("/")
    public String home() {
        return "redirect:/index";
    }

    @ResponseBody
    @RequestMapping("/index")
    public Map index() {
        Map<String, Object> map = new HashMap<>();
        map.put("code", 200);
        map.put("msg", "OK");
        return map;
    }

}
